 /**
 * @file tkl_attribute_rw.h
 * @brief Common process - attribute read/write
 * @version 1.0.0
 * @date 2021-04-30
 *
 * @copyright Copyright 2021-2022 Tuya Inc. All Rights Reserved.
 *
 */

#ifndef __TKL_ATTRIBUTE_RW_H__
#define __TKL_ATTRIBUTE_RW_H__


#ifdef __cplusplus
    extern "C" {
#endif

#include "tuya_cloud_types.h"
#include "tuya_zigbee_stack.h"
#include "tkl_endpoint_register.h"

/**
 * @brief read attribute
 *
 * @param[in]   triplet:    attribute triplet
 * @param[in]   attr_id:    attribute id
 * @param[in]   data:       pointer to the data buff
 * @param[in]   len:        length of read data
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */
OPERATE_RET tkl_zg_read_attribute(TKL_CLUSTER_TRIPLET_T *triplet,
                                    UINT16_T attr_id,
                                    VOID_T *data,
                                    UINT8_T len);

/**
 * @brief write attribute
 *
 * @param[in]   triplet:    attribute triplet
 * @param[in]   attr_id:    attribute id
 * @param[in]   data:       pointer to the data buff
 * @param[in]   type:       attribute type
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */
OPERATE_RET tkl_zg_write_attribute(TKL_CLUSTER_TRIPLET_T *triplet,
                                    UINT16_T attr_id,
                                    VOID_T *data,
                                    ZG_ATTR_TYPE_E type);


#ifdef __cplusplus
}
#endif

#endif
